package demo2;

import java.util.Arrays;

public class test {


    public static void Bubble(Comparable[] comparas){
        for(int i=0;i<comparas.length;i++){
            for(int j=0;j<comparas.length-1-i;j++){
                if(comparas[j].compareTo(comparas[j+1])>0){
                    Comparable tem=comparas[j];
                    comparas[j]=comparas[j+1];
                    comparas[j+1]=tem;

                }
            }
        }

    }
    public static void main(String[] args) {
        Person[] persons=new Person[3];
        persons[0]=new Person("zhangsan",18,80);
        persons[1]=new Person("lisi",14,90);
        persons[2]=new Person("wangwu",17,50);
        Bubble(persons);
        System.out.println(Arrays.toString(persons));

    }
}
